<template>
	<view class="content">
		<view class="title">
			子组件B-----
		</view>
		<view class="b-box">
			CompA组件传进来的值：----
			<text class="intent-text-box"></text>
		</view>
		<view class="b-box" style="margin: 10rpx;">
			<text>回传值：</text>
			<input type="text" style="color: yellow;" v-model="bvalue" />
			<button size="mini" @click="sentOut()">回传</button>
		</view>
	</view>
</template>

<script>
	export default {
		name:"CompB",
		data() {
			return {
				bvalue:''
			};
		},
		created() {
			console.log("created comB");
			// (msg)=>{}
			uni.$on('fasong',(msg)=>{
				console.log("COMB 处理回调" + msg);
			})
		},
		mounted() {
			console.log("mounted comB");
		},
		methods:{
			sentOut(){
				console.log('comp B sentOut');
				this.$emit('jiantingqi',this.bvalue);
			}
		}
	}
</script>

<style>
	.content {
		height: 300rpx;
		margin: 50rpx;
		background-color: #4CD964;
	}

	.title {
		font-size: 50rpx;
		text-align: center;
	}

	.intent-text-box {
		font-weight: bold;
		background-color: blue;
		color: white;
		padding-left: 20rpx;
		padding-right: 20rpx;
	}

	.b-box {
		height: 80rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		padding-left: 20rpx;
	}

	input {
		width: 250rpx;
		background-color: #C0C0C0;
	}
</style>